import request from "@/utils/request";

/**
 * 校验手机号是否可以注册
 * @param tel 手机号
 * @returns
 */
export function checkPhone(tel: string) {
  return request({
    url: "/api/user/docheckphone",
    method: "POST",
    data: {
      tel,
    },
  });
}

/**
 * 发送短信验证码
 * @param tel 手机号
 * @returns
 */
export function sendSmsCode(tel: string) {
  return request({
    url: "/api/user/dosendmsgcode",
    method: "POST",
    data: {
      tel,
    },
  });
}

/**
 * 校验验证码
 * @param tel 手机号
 * @param telcode 验证码
 * @returns
 */
export function checkCode(tel: string, telcode: string) {
  return request({
    url: "/api/user/docheckcode",
    method: "POST",
    data: {
      tel,
      telcode,
    },
  });
}

/**
 * 最终注册
 * @param tel 手机号
 * @param password 密码
 * @returns
 */
export function doFinishRegister(tel: string, password: string) {
  return request({
    url: "/api/user/dofinishregister",
    method: "POST",
    data: {
      tel,
      password,
    },
  });
}
